﻿
namespace personalplaner.business.stamm
{
    public class Abteilung : ItemBase
    {
        protected override string IsPropertyValid(string property)
        {
            switch (property)
            {
                case "Name":
                    if (string.IsNullOrEmpty(Name))
                        return "Name";
                    break;
                case "EinsaetzeProTag":
                    if (EinsaetzeProTag <= 0)
                        return "EinsaetzeProTag";
                    break;
            }

            return base.IsPropertyValid(property);
        }

        #region Properties

        /// 
        /// this override has to be made for the IsPropertyValid method to call Name
        /// 
        public override string Name
        {
            get
            {
                return base.Name;
            }
            set
            {
                base.Name = value;
            }
        }

        int _abteilungid;
        public int AbteilungID
        {
            get
            {
                return _abteilungid;
            }
            set
            {
                _abteilungid = value;
                RaisePropertyChanged("AbteilungID");
            }
        }

        string _beschreibung;
        public string Beschreibung
        {
            get
            {
                return _beschreibung;
            }
            set
            {
                _beschreibung = value;
                RaisePropertyChanged("Beschreibung");
            }
        }

        double _einsatzprotag;
        public double EinsaetzeProTag
        {
            get
            {
                return _einsatzprotag;
            }
            set
            {
                _einsatzprotag = value;
                RaisePropertyChanged("EinsaetzeProTag");
            }
        }

        #endregion
    }
}
